package CreatorPattern.Singleton;

/**
 * @author: Themberfue
 * @date: 2025/8/10 11:11
 * @description:
 */
public class HungrySingleton {
    // 1. 在类加载时就创建唯一实例
    private static final HungrySingleton instance = new HungrySingleton();

    // 2. 构造方法私有化
    private HungrySingleton() {}

    // 3. 提供获取实例的公共方法
    public static HungrySingleton getInstance() {
        return instance;
    }

    public void showMessage() {
        System.out.println("Hello from HungrySingleton!");
    }
}

